<%@ page import="org.windey.server.database.Database" %>
<%@ page import="org.windey.server.database.Md5Generator" %>
<%

if (request.getParameter("login") == null) {
	response.sendRedirect("login.jsp");
}
else {
	String email = request.getParameter("email");
	String password = request.getParameter("pass");
	Md5Generator md5 = new Md5Generator();
	password = md5.generateMD5(password);
	if (Database.checkLogin(email, password)) {
		session.setAttribute("user", Database.getUserByEmail(email));
	}
	response.sendRedirect("index.jsp");
	
}

%>